<?php

/**
 * Created by PhpStorm.
 * User: Yieong
 * Date: 2016/11/9
 * Time: 上午11:52
 */
class ModPatrol {

    public static function indexData($params){
        $table = 'tblGameRolePatrol';
        $where  = ' WHERE RecDate BETWEEN :begin AND :end AND Period=:period
                        AND Platform=:platform AND GameSrc=:game AND SID=:server ';

        $args   = array(
            ':begin'    => $params['time_start'],
            ':end'      => $params['time_end'],
            ':period'   => 'Daily',
            ':platform' => $params['os'],
            ':game'     => $params['g'],
            ':server'   => empty($params['server']) ? 'ALL' : $params['server'],
        );

        $sql = "SELECT * FROM {$table} {$where}";

        $dbLink = new PubDbLink('dbSelf', PubDatabase::getMgmtDbName($params['p'], $params['g']));

        return $dbLink->query($sql, $args);
    }
}